Skip to content

Conversation

@brunopgalvao
Copy link
Contributor

πŸ“ Description

Resolves #1085

πŸ” Review Preference

Choose one:

  • βœ… I have time to handle formatting/style feedback myself
  • ⚑ Docs team handles formatting (check "Allow edits from maintainers")

πŸ€– AI-Ready Docs

If content changed, regenerate AI files:

  • βœ… I ran python3 scripts/generate_llms.py
  • ⚑ Docs team will regenerate (check "Allow edits from maintainers")

βœ… Checklist

@brunopgalvao brunopgalvao self-assigned this Nov 7, 2025
@brunopgalvao brunopgalvao added B0 - Needs Review Pull request is ready for review C1 - Medium Medium priority task A0 - New Content Pull request contains new content pages labels Nov 7, 2025
@brunopgalvao brunopgalvao marked this pull request as ready for review November 8, 2025 04:17
@brunopgalvao brunopgalvao requested a review from a team as a code owner November 8, 2025 04:17
Copy link
Collaborator

@nhussein11 nhussein11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting read, thank you!

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request comprehensively rewrites the pallet benchmarking guide, transforming it from a general framework overview into a hands-on tutorial that builds on the pallet development series. The changes provide step-by-step instructions for benchmarking custom pallets, from creating benchmarking modules to integrating generated weights into production runtimes.

Key changes:

  • Complete rewrite of the benchmark guide with practical, actionable steps for the custom counter pallet example
  • Title updates for consistency: "Pallet Testing" β†’ "Unit Test Pallets" and "Benchmarking FRAME Pallets" β†’ "Benchmark Your Pallet"
  • Addition of detailed explanations for each step, including weight trait definitions, runtime integration, and production deployment

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
benchmark-pallet.md Complete rewrite from conceptual overview to practical tutorial with code examples for benchmarking custom pallets
pallet-testing.md Title updated to "Unit Test Pallets" for better clarity and consistency
create-a-pallet.md Added reference to setup guide for Polkadot Omni Node and Chain Spec Builder
.nav.yml Updated navigation title to match renamed "Unit Test Pallets"
llms.txt, llms-full.jsonl, .ai/* Regenerated AI-ready documentation files with updated content

πŸ’‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +315 to +316
curl -L https://raw.githubusercontent.com/paritytech/polkadot-sdk/refs/tags/polkadot-stable2412/substrate/.maintain/frame-weight-template.hbs \
--output ./pallets/pallet-custom/frame-weight-template.hbs
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The curl command is missing the -L flag to follow redirects in one location but has it in another. For consistency with line 314, this curl command should also include the -L flag to ensure redirects are followed properly.

curl -L https://raw.githubusercontent.com/paritytech/polkadot-sdk/refs/tags/polkadot-stable2412/substrate/.maintain/frame-weight-template.hbs \
--output ./pallets/pallet-custom/frame-weight-template.hbs

Copilot uses AI. Check for mistakes.
Comment on lines +88 to 117
#[frame::pallet]
pub mod pallet {
use frame::prelude::*;
pub use weights::WeightInfo;

pub mod weights {
use frame::prelude::*;

pub trait WeightInfo {
fn set_counter_value() -> Weight;
fn increment() -> Weight;
fn decrement() -> Weight;
}

impl WeightInfo for () {
fn set_counter_value() -> Weight {
Weight::from_parts(10_000, 0)
}
fn increment() -> Weight {
Weight::from_parts(15_000, 0)
}
fn decrement() -> Weight {
Weight::from_parts(15_000, 0)
}
}
}

// ... rest of pallet
}
```
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The title in the code block differs from the actual file path. The file path shown is pallets/pallet-custom/src/benchmarking.rs but the title attributes indicate pallets/pallet-custom/src/lib.rs. This inconsistency could confuse readers about which file they should be editing.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brunopgalvao Can you please verify which file name is correct for this code block and I will update if needed? Thanks!

Copy link
Collaborator

@dawnkelly09 dawnkelly09 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question for Bruno. This can be checked by Erin.

Comment on lines +88 to 117
#[frame::pallet]
pub mod pallet {
use frame::prelude::*;
pub use weights::WeightInfo;

pub mod weights {
use frame::prelude::*;

pub trait WeightInfo {
fn set_counter_value() -> Weight;
fn increment() -> Weight;
fn decrement() -> Weight;
}

impl WeightInfo for () {
fn set_counter_value() -> Weight {
Weight::from_parts(10_000, 0)
}
fn increment() -> Weight {
Weight::from_parts(15_000, 0)
}
fn decrement() -> Weight {
Weight::from_parts(15_000, 0)
}
}
}

// ... rest of pallet
}
```
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brunopgalvao Can you please verify which file name is correct for this code block and I will update if needed? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A0 - New Content Pull request contains new content pages B0 - Needs Review Pull request is ready for review C1 - Medium Medium priority task

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants